package by.koleda.benicetobunnies.manager;

import java.util.List;

import android.content.Context;
import by.koleda.benicetobunnies.content.CompaniesList;
import by.koleda.benicetobunnies.helper.BarcodeAsyncTask;
import by.koleda.benicetobunnies.helper.ParamCallback;
import by.koleda.benicetobunnies.model.Company;

public class ContentManager {

	private static ContentManager instance;

	public static final String DO_TEST_URL = "http://benice.do.am/_ld/0/2_dotesting.json";
	
	public static final String GTIN_URL = "http://gs46.gs1ru.org/GEPIR31/process?p=gtin&lng=en&mode=party&gtin=";

	private ContentManager() {

	}

	public static ContentManager getInstance() {
		if (instance == null) {
			instance = new ContentManager();
		}
		return instance;
	}
	
	public void getContent(Context context, final ParamCallback<List<Company>> paramCallback) {
		new CompaniesList(paramCallback).start(DO_TEST_URL);
	}
	
	public void getCompanyNameByBarcode(Context context, String barcode, final ParamCallback<String> paramCallback) {
		new BarcodeAsyncTask(paramCallback).start(GTIN_URL+barcode);
	}
}
